package Thread;

import java.util.concurrent.ExecutorService;

public class ThreadPoolTest {
    public static void main(String[] args) throws InterruptedException {
        ExecutorService executorService = ThreadPool.threadPool(2,4,60);

        executorService.execute(() -> {
            try {
                Thread.sleep(2000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            System.out.println(Thread.currentThread().getName());
        });

        executorService.execute(() -> {
            try {
                Thread.sleep(2000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            System.out.println(Thread.currentThread().getName());
        });

        executorService.shutdown();

        Thread thread = new Thread(() -> {
            System.out.println("b");
        });
        thread.start();
        Thread.sleep(2000);
        thread.start();
    }
}
